#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#define REP(i,n) for(int i=0;i<int(n);++i)

using namespace std;

struct Edge
{
    int a,b,w;
    long long ans;
    int id;
    bool operator < (Edge eb) const
    {
        return w < eb.w;
    }
};

Edge edge[100100];
int n;
bool done[100100];
vector<int> nextEdge[100100];
vector<int> vtemp,etemp;

class DSU
{
    public:
    int *gsize;
    int *parent;
    DSU(int n=0)
    {
        gsize = new int[n+5];
        parent = new int[n+5];
        REP(i,n+5) parent[i] = i, gsize[i] = 1;
    }
    int getGroup(int a)
    {
        if(parent[a]!=a) parent[a] = getGroup(parent[a]);
        return parent[a];
    }
    bool merge(int a,int b)
    {
        int x = getGroup(a);
        int y = getGroup(b);
        if(x==y) return false;
        parent[x] = y;
        gsize[y] += gsize[x];
        return true;
    }
    int dfs(int vs)
    {
        done[vs] = true;
        int sumAfter;
        sumAfter = 0;
        REP(i,nextEdge[vs].size())
        {
            Edge &et = edge[nextEdge[vs][i]];
            int v1 = getGroup(et.a);
            int v2 = getGroup(et.b);
            int vt = v1==vs?v2:v1;
            if(!done[vt])
            {
                int after = dfs(vt);
                et.ans = after;
                sumAfter += after;
                etemp.push_back(nextEdge[vs][i]);
            }
        }
        return gsize[vs] + sumAfter;
    }
};

int main()
{
    cin>>n;
    REP(i,n-1) scanf("%d%d%d",&edge[i].a,&edge[i].b,&edge[i].w),edge[i].id = i+1;
    sort(edge,edge+n-1);
    DSU uni(n);
    REP(i,n-1)
    {
        int w = edge[i].w;
        for(int j=i;j<n-1&&edge[j].w==w;j++)
        {
            int ga = uni.getGroup(edge[j].a);
            int gb = uni.getGroup(edge[j].b);
            nextEdge[ga].clear();
            nextEdge[gb].clear();
            done[ga] = done[gb] = false;
            vtemp.push_back(ga);
            vtemp.push_back(gb);
        }
        for(int j=i;j<n-1&&edge[j].w==w;j++)
        {
            int ga = uni.getGroup(edge[j].a);
            int gb = uni.getGroup(edge[j].b);
            nextEdge[ga].push_back(j);
            nextEdge[gb].push_back(j);
        }
        while(!vtemp.empty())
        {
            int v = vtemp.back();
            vtemp.pop_back();
            if(!done[v])
            {
                int sum = uni.dfs(v);
                while(!etemp.empty())
                {
                    Edge &et = edge[etemp.back()];
                    etemp.pop_back();
                    et.ans*=sum-et.ans;
                }
            }
        }
        for(int j=i;j<n-1&&edge[j].w==w;j++)
        {
            int ga = uni.getGroup(edge[j].a);
            int gb = uni.getGroup(edge[j].b);
            uni.merge(ga,gb);
            i=j;
        }
    }
    long long tmax = -1;
    REP(i,n-1) tmax = max(tmax,edge[i].ans);
    printf("%I64d ",tmax<<1);
    vector<int> ans;
    REP(i,n-1) if(edge[i].ans==tmax) ans.push_back(edge[i].id);
    printf("%d\n",ans.size());
    sort(ans.begin(),ans.end());
    REP(i,ans.size()) printf("%d ",ans[i]);
    cout<<endl;
	return 0;
}
